package com.lanxin.oa.zu.service.serviceImpl;

import com.lanxin.bean.MpContact;
import com.lanxin.oa.zu.dao.MingPianDao;
import com.lanxin.oa.zu.service.MingPianService;
import com.lanxin.util.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MingPianServiceImpl implements MingPianService {
    @Autowired
    MingPianDao dao;

    @Override
    public PageBean selectmp(Integer page, Integer pageSize, String name, String sex, String company, Integer typeid, String officePhone) {
        return dao.selectmp(page,pageSize,name,sex,company,typeid,officePhone);
    }

    @Override
    public void insertmp(MpContact mp) {
        dao.add(mp);
    }

    @Override
    public List selectzu() {
        return dao.selectzu();
    }

    @Override
    public MpContact selectmpByid(Integer oid) {
        return dao.selectmpByid(oid);
    }

    @Override
    public void updatemp(MpContact mp) {
        dao.update(mp);
    }

    @Override
    public void yidongmp(Integer typeid, String mids) {
        String[] oids=mids.split(",") ;
        if(oids!=null&&oids.length>0){
            for(String id:oids){
               MpContact mp= dao.selectmpByid(Integer.valueOf(id));
               mp.setTypeid(typeid);
               dao.update(mp);
            }
        }

    }
}
